package main

import (
	"context"
	"core/coreinit"
	"core/corerun"
	"core/corestruct"
	"core/db"
	"core/server/baseserver"
)

// $env:IOTCONFIG="abcd"
func main() {
	coreinit.Init()

	var ctx = &corestruct.HttpContext{
		Id: 0,
		Session: &corestruct.HttpSession{
			CrtUid:   1000,
			HtdeptId: 1000,
		},
		DB: db.DbMaster,
	}

	dbctx := context.WithValue(context.Background(), "MyContext", ctx)
	var db = db.DbMaster.WithContext(dbctx)
	ctx.DB = db

	corerun.DbSetup("core")
	corerun.StructToDb("core", db)

	baseserver.WaitCloseSignals()
}
